
/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"E01C9E7F-95FC-4600-8155-167B5D33AE84"}
 */
function onShow(firstShow, event) {
	databaseManager.setAutoSave(false)
	controller.newRecord()
	return true
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"5BAD7572-0BF0-4BD3-80E7-C7F8D9DA167A"}
 */
function guardar(event) {
	if (forms.empresa_dtl_pass.fPassNuevo2 && forms.empresa_dtl_pass.fPassNuevo)
	{
		if (forms.empresa_dtl_pass.fPassNuevo == forms.empresa_dtl_pass.fPassNuevo2)
		{
			hash_pass = utils.stringPBKDF2Hash(forms.empresa_dtl_pass.fPassNuevo,2000)
		}
		else
		{
			globals.DIALOGS.showWarningDialog('Aviso','Las contraseñas no coinciden','OK')
		}
	}
	else
	{
		globals.DIALOGS.showWarningDialog('Aviso','Por favor, indique la contraseña','OK')
	}
	if (databaseManager.saveData())
	{
		globals.DIALOGS.showInfoDialog('Aviso','Los cambios fueron guardados','OK')
		security.logout()
	}
	else
		globals.DIALOGS.showWarningDialog('Aviso','Ocurrió un error al grabar los cambios','OK')
}
